<script setup lang="ts">
import {ref} from "vue";

const money = ref(200);
const setMoney = function(){
    money.value-=9;
}
const fn = function(parent:any){
    // console.log("fn",parent)
    parent.value.money-=20;
    money.value+=20;
}
defineExpose({money,setMoney});
</script>

<template>
    <h3>Child</h3>
    {{money}}
    <button @click="fn($parent)">向父亲借20元</button>
</template>

<style scoped>

</style>